home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / 0utils.lha / 0Utils / wb_Update.data < prev    next >
Text File  |  1995-08-19  |  2KB  |  90 lines

  1.  
  2. #ifdef TPLTER
  3.  
  4. wb_Update = {
  5.  
  6.     Short = {{ Notify WB about Icon image changes }};
  7.  
  8.     DESCRIPTION = {{
  9.     Notify Workbench about a modified or newly
  10.     created icon. (we cannot notify it about
  11.     renames or about deletions!)
  12.     }};
  13.  
  14.     BUGS = {{
  15.     Since Amiga is multitasking, it _is_ possible, that an iconfile
  16.     is created, after we have checked for its existance, and we
  17.     delete it while erasing our fake DefIcon ... (but hey, U should
  18.     call this command only _after_ creating Your files ...)
  19.     }};
  20.  
  21.     TODO = {{
  22.     wildcards (this should be part of ReadArgs)
  23.     }};
  24.  
  25.     HISTORY = {{
  26.     12-02-95 b_noll created
  27.     20-02-95 b_noll restructured source
  28.     21-02-95 b_noll added version/format-prefix/offset
  29.     20-03-95 b_noll added args diagnostics
  30.     18-05-95 b_noll created WB_Update from WB_Delete srcs
  31.     19-08-95 b_noll created .data file
  32.     }};
  33.  
  34.  
  35.     Libraries = { Icon; };
  36.     Includes  = { "<string.h>" };
  37.  
  38.     Template = "FILE/M/A,ONLYICONS/S";
  39.     Arguments = {{
  40.     STRPTR* file;
  41.     ULONG    onlyIcons;
  42.     }};
  43.  
  44.     version = "1.2";
  45.  
  46.     body = {{
  47.         long cnt;
  48.         UBYTE buffer [MAXPATHLEN];
  49.         BPTR lock;
  50.         struct DiskObject *dob;
  51.  
  52.         //if (IconBase = OpenLibrary(ICONNAME, 37)) {
  53.  
  54.         retval = RETURN_OK;
  55.  
  56.         for (cnt = 0; argv->file[cnt] && !retval; ++cnt) {
  57.  
  58.             buffer[0] = 0;
  59.             strcat (buffer, argv->file[cnt]);
  60.  
  61.             PutStr(buffer);
  62.             if ((dob = GetDiskObject(buffer))) {
  63.             if (!PutDiskObject(buffer,dob))
  64.                 PrintFault(IoErr(), "...failed");
  65.             else
  66.                 PutStr ("...done\n");
  67.             FreeDiskObject(dob);
  68.             } else if (!argv->onlyIcons && (dob = GetDiskObjectNew(buffer))) {
  69.             if (!PutDiskObject(buffer,dob))
  70.                 PrintFault(IoErr(), "...failed");
  71.             else
  72.                 PutStr ("...faked\n");
  73.             FreeDiskObject(dob);
  74.             strcat (buffer, ".info");
  75.             DeleteFile (buffer);
  76.             } else {
  77.             PrintFault(IoErr(), "...failed");
  78.             retval = RETURN_ERROR;
  79.             } /* if */
  80.         } /* for */
  81.  
  82.         //      CloseLibrary (IconBase);
  83.         //} /* if */
  84.     }};
  85. };
  86.  
  87. #endif
  88.  
  89.  
  90.